package com.wangxc.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.wangxc.core.IDemoService;
import com.wangxc.dao.UserRepository;
import com.wangxc.model.User;
import org.junit.Assert;
import javax.annotation.Resource;


/**
 * @Date: 16:52  2017/12/4 0004.
 * @Author: WangXC
 */
@Service(version = "1.0.0.1")
public class DemoServiceImpl implements IDemoService {

    @Resource
    private UserRepository userRepository;

    @Override
    public String sayHello(String hello) {
        try {
            Assert.assertNotNull(userRepository);
            User user = new User();
            user.setName(hello);
            System.out.println(user);
            userRepository.save(user);
            System.out.println("SAY HELLO");
            return "hello";
        } catch (Exception e) {
            return e.getMessage();
        }
    }
}
